package com.fengmi.controller;

import com.fengmi.entity.dto.SearchDTO;
import com.fengmi.entity.goods.ESGoods;
import com.fengmi.entity.goods.MallGoods;
import com.fengmi.entity.vo.PageResultVO;
import com.fengmi.entity.vo.ResultVO;
import com.fengmi.service.ISearchService;
import org.bouncycastle.crypto.modes.G3413CBCBlockCipher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("search")
public class SearchController {
    @Autowired
    private ISearchService searchService;
    @RequestMapping("init")
    public ResultVO init(){
        return searchService.goods2es();
    }

    @RequestMapping("goods")
    public PageResultVO<ESGoods> page(@RequestBody SearchDTO searchDTO){
        return searchService.search(searchDTO);
    }

    @RequestMapping("goodsToBu")
    public ResultVO goodsToBu(@RequestBody MallGoods goods){
        return searchService.goodsToBu(goods);
    }
}
